// or http://127.0.0.1:7001/chat
import io from "socket.io-client"

// let socket = io('http://127.0.0.1:7001');



export default class {
  constructor(){
    this.url = 'http://127.0.0.1:7001'
    this.socket = null
  }
  init(){
    this.socket = io('http://127.0.0.1:7001');
    this.socket.on('connect', () => {
      console.log('connect!');
      this.socket.emit('chat', 'hello world!');
    });
    
    this.socket.on('res', msg => {
      console.log('res from server: %s!', msg);
    });
  }
  
}

// socket.on('connect', () => {
//   console.log('connect!');
//   socket.emit('chat', 'hello world!');
// });

// socket.on('res', msg => {
//   console.log('res from server: %s!', msg);
// });
